CC=g++
CFLAGS=-Wall -Wextra -O2 -g
INCLUDES=-I /usr/include/opencv
LDFLAGS=-L /usr/lib -lm -lcv -lhighgui -lcvaux
SOURCES=a3.cpp
EXECUTABLE=a3

# directories
SRCDIR=src
OBJDIR=obj
BINDIR=bin

# replace the path of the .cpp files with the obj path for .o files
OBJECTS=$(patsubst %.cpp,$(OBJDIR)/%.o,$(notdir $(SOURCES)))

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(INCLUDES) $(LDFLAGS) $(OBJECTS) -o $(BINDIR)/$@

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<

clean:
	rm -f $(OBJDIR)/* $(BINDIR)/*
